<template>
  <div class="list">
    <!-- <item v-for="(value,index) in initGood" :key="index" :itemInfo="value">
    </item> -->
    <item v-for="(value,index) in initOrder" :key="index" :itemInfo="value" @deleteOrder="deleteOrder">
      <button class="button" slot="button">接收</button>
    </item>
  </div>
</template>

<script>
  import item from './orderListItem.vue'
  import {getAllOrder} from 'network/order/order.js'
  export default{
    name:'',
    data(){
      return {
        initOrder:[],
        test:1,
        price:0,
        orderShow:[]
       }
    },
    computed:{

    },
    methods:{
      deleteOrder(id){
        for(let i of this.initOrder){
          if(i.id==id){
            console.log('iid');
            i.state=0
          }
        }
      }
    },
    activated() {
      let id=JSON.parse(window.sessionStorage.user).id
      getAllOrder(id).then((res)=>{
        console.log('order',res);
        this.initOrder=res.data.list
      }).catch(e=>{
        console.log(e);
      })
      // this.$bus.$on("sendGoodToOrder",res=>{
      //   this.goods=res
      // })
    },
    components:{
      item
    }
  }
</script>

<style scoped>
  .list{
    /* background:linear-gradient(to bottom,#0080FF,#00ec00); */
  }
</style>
